package com.ifcar.app.activity;

import com.ifcar.app.util.Tools;
import com.ifcar.app.activity.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;

public class AccountForgetPassword extends Activity {
    
    private WebView forgetpasswordWebview;
    private LinearLayout loadingbar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.accountforgetpassword);
        findViewsById();
        forgetpasswordWebview.getSettings().setJavaScriptEnabled(true);
        String host = Tools.getHostbyWAP(this);
        if(null!=host){
            forgetpasswordWebview.enablePlatformNotifications();
            forgetpasswordWebview.setHttpAuthUsernamePassword(host,"","","");
        }
        setListener();
        
        new Thread() {
            public void run() {
                forgetpasswordWebview.loadUrl("http://reg.163.com/reg/reg_mob2_retake_pw.jsp");
            }
        }.start();
    }
    
    private void findViewsById() {
        forgetpasswordWebview = (WebView)findViewById(R.id.forgetpasswordWebview);
        loadingbar = (LinearLayout) findViewById(R.id.weibologin_loadingbar);
        loadingbar.setVisibility(View.VISIBLE);
     }
    
    private void setListener(){
        forgetpasswordWebview.setWebViewClient(new WebViewClient(){
            @Override
            public void onPageFinished(WebView view, String url) {
                // TODO Auto-generated method stub
              
                loadingbar.setVisibility(View.GONE);
                super.onPageFinished(view, url);
            }
        });
    }
    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        String host = Tools.getHostbyWAP(this);
        if(null!=host){
            if(null!=forgetpasswordWebview){
                forgetpasswordWebview.disablePlatformNotifications();
            }
        }
        
    }
}
